<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<!-- RichFaces tag library declaration -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>

<rich:panel style="width:225px;" styleClass="loginForm">
    <a4j:form ajaxSubmit="true">
        <h:panelGrid columns="2">
            <h:outputText value="Логин: "/>
            <h:inputText value="#{loginBean.login}" id="name" required="true" immediate="true">
                <f:validateLength minimum="3" maximum="12"/>
            </h:inputText>

            <h:outputText value="Пароль: "/>
            <h:inputSecret value="#{loginBean.password}" id="password" required="true" immediate="true">
                <f:validateLength minimum="5" maximum="12"/>
            </h:inputSecret>

            <h:outputLink id="registerLink" value="#">
                Регистрация
                <rich:componentControl for="registerModalPanel" attachTo="registerLink" operation="show"
                                       event="onclick"/>
            </h:outputLink>
            <a4j:commandButton id="loginCommand" value="Впустите, пожалуйста!" action="#{loginBean.doLogin}"
                               reRender="userAuthGroup"/>
            <h:message styleClass="error" for="loginCommand"/>

            <rich:hotKey key="return" handler="#{rich:element('loginCommand')}.click(); return false;"
                         checkParent="true"/>
        </h:panelGrid>
    </a4j:form>
    <a4j:include viewId="/user/register.jsp"/>
</rich:panel>
